package com.chinatsp.onlineapp.presenter;

import tsp.cn.http.BaseIDao;
import tsp.cn.http.HttpConfig;
import tsp.cn.http.interfac.INetResult;
import tsp.cn.http.tools.LogUtil;
import android.content.Context;

import com.chinatsp.onlineapp.base.Config;
import com.chinatsp.onlineapp.bean.AllCityBean;
import com.chinatsp.onlineapp.bean.HotCityBean;
import com.google.gson.Gson;

/**
 * 获取热门城市
 */

public class GetHotCityDao extends BaseIDao {
	HotCityBean mHotCityBean;
	
	public GetHotCityDao(Context context, INetResult iNetResult) {
		super(context, iNetResult);
	}

    public HotCityBean getHotCityBean(){
    	return mHotCityBean;
    }
    
	/**
	 * 得到结果，对结果进行处理
	 * 
	 * @param result
	 * @param requestCode 
	 */
	@Override
	public void onRequestSuccess(String result, int requestCode) {
		//LogUtil.d( "GetHotCityDao success "+result); 
		mHotCityBean = new Gson().fromJson(result, HotCityBean.class);
	}

	/**
	 * 热门城市
	 */
	public void getHotList() {

		StringBuilder strBuilder = new StringBuilder();
		strBuilder.append(HttpConfig.appendString());
		strBuilder.append(Config.API_GET_HOT_CITY);

		getRequest(strBuilder.toString(), Config.CODE_GET_HOT_CITY);
	}
}
